<template>
  <view>
    <navigator url="/pages/login/login">启动应用</navigator>
  </view>
</template>

<script lang='ts' setup>
	import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
	onLaunch(() => {
		let token = uni.getStorageSync('token');
		let userInfo = uni.getStorageSync('userInfo');
		if (token && userInfo) {
		  //存在则跳转至首页
		  uni.reLaunch({
		    url: "/pages/myDevices/myDevices",
		  })
		  //setTimeout(() => {
		  //  uni.reLaunch({
		  //    url: "/pages/myDevices/myDevices",
		  //  })
		  //}, 1)
		} else {
		  //不存在跳转到登录
		  uni.reLaunch({
		    url: "/pages/login/login",
		  })
		  //setTimeout(() => {
		  //  uni.reLaunch({
		  //    url: "/pages/login/login",
		  //  })
		  //}, 1)
		}
	  console.log('App Launch')
	})
	onShow(() => {
	  console.log('App Show')
	})
	onHide(() => {
	  console.log('App Hide')
	})
</script>

<style>
/* 全局样式 */
	body {
	  margin: 0;
	  font-family: Arial, sans-serif;
}

.logout-popup-small-buttons .common-popup-content .popup-actions .popup-button {
  font-size: 24rpx !important; /* 使用 !important 可能需要，以覆盖组件内部样式 */
  padding: 12rpx 0 !important;
  width: 12rpx;
}
</style>